UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IcjSMro9zrfA+wCPRP1PegwvNMix6GuglnPe4StbPgc=' 
WHERE 
  key_id = '04da199130fe9575d35c3df6b0e184b7900b1f351f630fdd99f33edd99d0f050' 
  AND (
    token = 'IcjSMro9zrfA+wCPRP1PegwvNMix6GuglnPe4StbPgc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029