UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pdooeBg1cFbmI0q+/TyIR1BiSfpTtC2jbPxoqojGeps=' 
WHERE 
  key_id = '77462dba237f949f70323660c7828e176f6761a0d1046b80cc1fcbc4754e29a0' 
  AND (
    token = 'pdooeBg1cFbmI0q+/TyIR1BiSfpTtC2jbPxoqojGeps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043