UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x6y2XysMNQ8cDMQ4tOtHIuJkvVCXVI9hc6Yf+2BwzFw=' 
WHERE 
  key_id = '0a1cf6a294ba6d2f4681f256749df89edf06d46c4996df0b81f9f10f5d63000b' 
  AND (
    token = 'x6y2XysMNQ8cDMQ4tOtHIuJkvVCXVI9hc6Yf+2BwzFw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014