UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zioJohe6HS/2QRv20YcInDDBYj8vdrfY86v0FHY4OVQ=' 
WHERE 
  key_id = '8d9c05bc16977983625e0939c56e6bc69195313e5bb5c1f92144736fd6b453d1' 
  AND (
    token = 'zioJohe6HS/2QRv20YcInDDBYj8vdrfY86v0FHY4OVQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035