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

Query time 0.00027