UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gR6zmdnUCLu5EHTTFD/dplDirKeQ4OO0JKz1s+SsSfU=' 
WHERE 
  key_id = '923d11f7e717a7b2931a525355298cd16bfd8044a0b604c1dea59bed9393d782' 
  AND (
    token = 'gR6zmdnUCLu5EHTTFD/dplDirKeQ4OO0JKz1s+SsSfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036