UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+cAukKEL1Pgo/wo3a61id6ZBRwYn/3heX/6iy/VYkx8=' 
WHERE 
  key_id = '12da9b56211f200e4aca470bc3943e69279f914696717d10a23be96022e249cd' 
  AND (
    token = '+cAukKEL1Pgo/wo3a61id6ZBRwYn/3heX/6iy/VYkx8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034