UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B919Oo8lSzG64ye/ryhCL9fZGoceyvN5rA2a580+suQ=' 
WHERE 
  key_id = '7b906a1dd71405fb40fd2fbffdfe7bb0b090ce53351d97265884eff887f5a260' 
  AND (
    token = 'B919Oo8lSzG64ye/ryhCL9fZGoceyvN5rA2a580+suQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034