UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P/pLOuT3cGSsDjn3DZS8QzNvGkp95Y1vPpRPLPEVhz4=' 
WHERE 
  key_id = 'cb328a2727aab9c65b8199d4c4d3e350035b6848d7cef0c1994d8bf9805371b5' 
  AND (
    token = 'P/pLOuT3cGSsDjn3DZS8QzNvGkp95Y1vPpRPLPEVhz4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030