UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UIUMY2kIs75DHS65hMEvs5IvG3cTHOiQ4YqwM/ADiII=' 
WHERE 
  key_id = '86d1488b20c07a17134634e266444a4f0e2127b9f027e4c1c2061ca345388f3b' 
  AND (
    token = 'UIUMY2kIs75DHS65hMEvs5IvG3cTHOiQ4YqwM/ADiII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034