UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DCi+A7xH7HyZZL5q5G9G4jQ3UcSfsMYAu9zyJhB7EB0=' 
WHERE 
  key_id = '3c32d72c0b870f7844e1494aa3c95b8017467535c228816d182f6bfad3323469' 
  AND (
    token = 'DCi+A7xH7HyZZL5q5G9G4jQ3UcSfsMYAu9zyJhB7EB0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032