UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1aeOI2yhDUOg4kiIMEUKjhrz9HrdNCOLgpotZU7VhdA=' 
WHERE 
  key_id = '08161831bc9cd0d668fb855d1989d303a2130dc9e7cfdede89e7da6165dffe4b' 
  AND (
    token = '1aeOI2yhDUOg4kiIMEUKjhrz9HrdNCOLgpotZU7VhdA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00115