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

Query time 0.00033