UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l2cC/2dALkMyqbaWd/PkCbexH0HogVI1wd7tXIqhu4Q=' 
WHERE 
  key_id = '6d1574d40d7d1e1c0eb9fe41c0df6f8ec3e28a53d58e048b1850fe7dee16316c' 
  AND (
    token = 'l2cC/2dALkMyqbaWd/PkCbexH0HogVI1wd7tXIqhu4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046