UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QHHLu91+lML25AEydpbVhIMTjbqGHJCcGNPtxLRLQxE=' 
WHERE 
  key_id = '878946ef3b80a832919e75392e6e2c5b0316a3113c9feabd0242a4881ad9c72b' 
  AND (
    token = 'QHHLu91+lML25AEydpbVhIMTjbqGHJCcGNPtxLRLQxE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027