UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7IjlZSK68ZFJvrc9y+0OuNtVs6nY34dtUqAYrRo3hRA=' 
WHERE 
  key_id = 'c6940d429ebba7a4ad4fb8ba33b10abf58ec49129571b200c8ebb9f9cc748b94' 
  AND (
    token = '7IjlZSK68ZFJvrc9y+0OuNtVs6nY34dtUqAYrRo3hRA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030