UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nw9W586LTJJrEnKSsa225YhX61pHAxvnI3NRTmASbKs=' 
WHERE 
  key_id = '7b403d5940bc2911f4ec04c77b1e6e3953d74edd3e3652be0bfddd9384c4e2cb' 
  AND (
    token = 'Nw9W586LTJJrEnKSsa225YhX61pHAxvnI3NRTmASbKs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027