UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PC4fA9965m0NMmvwvYxQdq4cu/vRx3wqYN+JCTwADjk=' 
WHERE 
  key_id = 'bd55a9827af58984373a6df5a468f3ad44f9d3c61f56888be55e5526ba7f2ee4' 
  AND (
    token = 'PC4fA9965m0NMmvwvYxQdq4cu/vRx3wqYN+JCTwADjk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024