UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v4baX548cnbAK9BHmRXHHE80OrY5FkBay21aU/TqRVE=' 
WHERE 
  key_id = 'adef7c69d8837c3a782329fb6315a3e75c11bf048067dfa8460a071d146deac4' 
  AND (
    token = 'v4baX548cnbAK9BHmRXHHE80OrY5FkBay21aU/TqRVE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028