UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yroLal9z8/X88ThwG1l89QuJTxmuovy1YcIk5JcPPM4=' 
WHERE 
  key_id = '074fd1aea17cc8716319680d49a1453dfd3f153876d8090b3ab7c36e970821c1' 
  AND (
    token = 'yroLal9z8/X88ThwG1l89QuJTxmuovy1YcIk5JcPPM4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052