UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2Lu6MSz634rL2Bw0n5GQCU025xUip9l2yJsuSa770yQ=' 
WHERE 
  key_id = '12ead87c484949b221b83b759315fba593009dea7c07b94806858d5e0f20d3fc' 
  AND (
    token = '2Lu6MSz634rL2Bw0n5GQCU025xUip9l2yJsuSa770yQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026