UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rDKfRG2+D4KYx33zn1F4AUyQFx8W2JeVadjveWauaNE=' 
WHERE 
  key_id = '1907b8a0e7d6dcc29b262e11f53247b368ca47761e09704288813a0eb80c575d' 
  AND (
    token = 'rDKfRG2+D4KYx33zn1F4AUyQFx8W2JeVadjveWauaNE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036