UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S5b9ZkbZwAZRdR9sx0UWM4sUT5RzpGLYM1XU5nA5sds=' 
WHERE 
  key_id = 'b9ebc27aa649ae4b6fab4b9c5c5d542b3ca234778161fe2f578d9869cf245d6b' 
  AND (
    token = 'S5b9ZkbZwAZRdR9sx0UWM4sUT5RzpGLYM1XU5nA5sds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031