UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zZr+gu2CYMpl9aa8NtNCFt331xLW9woNRc26EyAizuo=' 
WHERE 
  key_id = 'ab34c062efffa99c75c6dedfce209cf4577339b86211da02a0ee89f41aa038f4' 
  AND (
    token = 'zZr+gu2CYMpl9aa8NtNCFt331xLW9woNRc26EyAizuo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032