UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h1VMfz83xmwW8jqETIbtOGuJcCxMQs7fo12UtnMKPjU=' 
WHERE 
  key_id = '8d753fdfac7a30823596279976297def4b6d05750d0ef7e5789a467d71a2ec2c' 
  AND (
    token = 'h1VMfz83xmwW8jqETIbtOGuJcCxMQs7fo12UtnMKPjU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058