UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pTOJ8NjeyxoHUQ+T68IYm22WBU5GT2NmDyuHUZSfhUs=' 
WHERE 
  key_id = 'a9a8274d5b835baed2c61f3a104b91559662e25fec22eb9222cfeb807b20b53b' 
  AND (
    token = 'pTOJ8NjeyxoHUQ+T68IYm22WBU5GT2NmDyuHUZSfhUs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00070