UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ho5NppyplGj/Doit0XarKJohWawUGIEALvbzQR+Vewo=' 
WHERE 
  key_id = '0eea0807e26f11dbf2487c8908d33436962400a2045065d6d18661cfe20b114e' 
  AND (
    token = 'Ho5NppyplGj/Doit0XarKJohWawUGIEALvbzQR+Vewo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027