UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ESlQpmR6S53zePMO9199aXZVFW+0aL3KG7N7X5CT5Po=' 
WHERE 
  key_id = '96a297fea0352262e27b2c99bb39b3893bdee575dfd910a38873601a23649a55' 
  AND (
    token = 'ESlQpmR6S53zePMO9199aXZVFW+0aL3KG7N7X5CT5Po=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042