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

Query time 0.00023