UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UIOpn6s4R/+peQNwWLTxhCcPEB1AXx5FlFiy26lmvx4=' 
WHERE 
  key_id = '3b63884eafae62b2beedc0fc6b8d3017db446877a683364aee97d1e11488fee6' 
  AND (
    token = 'UIOpn6s4R/+peQNwWLTxhCcPEB1AXx5FlFiy26lmvx4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027