UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rUFVVqD1SLnSduROCkhI+wv5unATCOWBjmzGIkO03p8=' 
WHERE 
  key_id = '57772c00e99671133c4e3de9eaaf51826cec28e78c4d44017378180cf65f9843' 
  AND (
    token = 'rUFVVqD1SLnSduROCkhI+wv5unATCOWBjmzGIkO03p8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040