UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rFn229sUR2V02wd7mwOZJDWAlSoUh3tEzObpXDlLFI8=' 
WHERE 
  key_id = '03de7fe6f7116e8f5876e07c5fd03d5d6caeecd53b4452401130350b675e8ed8' 
  AND (
    token = 'rFn229sUR2V02wd7mwOZJDWAlSoUh3tEzObpXDlLFI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046